<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>悦诗风吟官方网站</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
        }
        ul,li,ol{
            list-style: none;
        }
        a{
            text-decoration: none;
        }
        /* 头部 */
        /* 登陆注册 */
        #head{
            width: 1200px;
            height: 70px;
            margin: 0px auto;           
		}
        #logo{
            margin-left: 20px;
            position: relative;
			top: 8px;
            vertical-align: top;
        }
        #head-a{ 
            vertical-align: top;
            display: inline-block;            
            width: 190px;
            line-height: 70px;
            margin-left: 10px;
            margin-right: 70px;
            color: #fff;
            font-size: 18px;
            text-align: center;
            background: #024137;
            position: relative;		
            z-index: 11;	
        }
        #head-a a{
            color: #fff;
        }
        /* 搜索栏 */
        #head-b{
            /* 父级 */
            position: absolute;     
            width: 400px;
            display: inline-block;
        }
        #inp{
            margin-top: 10px;
            height: 40px; 
            width: 400px; 
            border: 1.5px solid #024137; 
            color: #757575; text-indent: 4em; 
            background: url(img/img1.png); 
            background-repeat: no-repeat; 
            background-position: 0px -4px;
            border-radius: 20px;
        }
        /* 热门搜索 */
        #PopularSearch{
            /* 以head-b对照移动位置 */
            position: absolute;
            z-index: 11;
            left: 20px;
            border: 1px solid black;
            width: 350px;
            height: 130px;
            background-color: #fff;  
            /* 隐含 */
            display: none;  
        }
        #PopularSearch p{
            padding-top: 20px;
            padding-left: 20px;
            padding-bottom: 8px;
            color: #024137;
            font-size: 14px;
        }
        #PopularSearch li{
            display: inline-block;
            margin-top: 10px;
            padding-left: 20px;
            margin-bottom: 5px;
            font-size: 13px;
        }
        #PopularSearch a{
            color: #757575;
        }
        /* 列表 */
        #list{
            margin-left: 423px;
            margin-top: 17px;
            display: inline-block;
        }
        .item{
            margin-right: 10px;
			margin-left: 15px;
            display: inline-block;
        }
        .item a{
            color: #757575;
            font-size: 14px;
        }
        /* banner图 在最下面*/
        #banner{
            position:absolute;
            top:70px;
            left:0px;
            z-index : -1;     
        }
        /* 全部商品分类 */
        #product{
            position:absolute;
            margin-left: 115px;
            display: inline-block;
        }
        .sort{
            display: inline-box;
            position: relative;
            border: 1px solid #ccc;
            background-color: #fff;
            width: 220px;
            line-height: 87px; 
            text-align: center;          
        }
        .sort img{
            width: 30px;
            position: relative;
            top: 5px;
            right: 4px;
        }
        .sort a{
            color: #000;
        }
        /* 分类内容 */
        #content{
            display: none;
            position: relative;
            top: 30px;
            left: 337px;
            background-color: #fff;
            width:800px;
            height: 378px;
        }
        #contentp{
            padding: 20px 20px;
            color: #024137;
            font-size: 20px;
        }
        #contentimg{
            width: 750px;
            height: 320px;
        }
        /*官方提示*/
        #end-wrap{
            margin-top: 407px;
            background: #024137;
            height: 230px;
        }
        #maintop-wrap{
            background: #024137;
        }
        #maintop{
            width: 1200px;
            height: 180px;
            margin: 0 auto;
        }
        #maintop p{
            padding-top: 30px;
            text-align: center;
            color: #fff;
            font-weight: bold;
            font-size: 20px;
        }
        #maintop ul{
            margin-top: 25px;
        }
        #maintop li{
            list-style: disc;
            color: #ccc;	
            line-height: 1.5em;
        }        
    </style>
</head>
<body>
	<!--头部-->
	<div id="head">
		<img id="logo" src="img/logo.png" alt="logo" width="170px"/>
		<div id="head-a">
			<span id="Hey" style="font-weight: bold;">Hey&nbsp;</span>
			<!-- href="sign.html" 跳转到登录界面 -->
            <a href="#" id="sign">登录&nbsp;</a> 
			<a href="sign.html" id="register">注册</a>
		</div>
        <div id="head-b">
		    <input id="inp" type="text" name="搜索栏" value="第四代小绿瓶">
		    <!-- 鼠标点击搜索栏后出现 -->
            <div id="PopularSearch">
                <p>
                    热门搜索
                </p>
                <ul>
                    <li><a href="https://www.innisfree.cn/search?keyword=%E7%AC%AC%E5%9B%9B%E4%BB%A3%E5%B0%8F%E7%BB%BF%E7%93%B6&type=2" class="Popularlist">小绿瓶</a></li>
                    <li><a href="https://www.innisfree.cn/search?keyword=%E9%99%90%E5%AE%9A%E6%95%A3%E7%B2%89&type=2 class="Popularlist">限定散粉</a></li>
                    <li><a href="https://www.innisfree.cn/search?keyword=%E5%B0%8F%E7%BB%BF%E7%93%B6&type=2" class="Popularlist">小绿瓶</a></li>
                    <li><a href="https://www.innisfree.cn/search?keyword=007%E7%B2%BE%E5%8D%8E&type=2" class="Popularlist">007精华</a></li>
                    <li><a href="https://www.innisfree.cn/search?keyword=%E7%BE%8E%E7%99%BD%E6%A9%98%E5%85%89%E7%93%B6&type=2" class="Popularlist">面膜</a></li>
                    <li><a href="#" class="Popularlist">洁面</a></li>
                    <li><a href="#" class="Popularlist">红茶</a></li>
                    <li><a href="#" class="Popularlist">蓝莓</a></li>
                    <li><a href="#" class="Popularlist">美白橘光瓶</a></li>
                </ul>
            </div>
        </div>
        <!-- 列表 -->
        <ul id="list">
			<li class="item"><a href="#">购物</a></li>
			<li class="item"><a href="#">热门活动</a></li>
			<li class="item"><a href="#">发现</a></li>
			<li class="item"><a href="#">关于我们</a></li>
		</ul>
	</div>
    <!-- 分类以及banner图 -->
    <div id="productparent">
        <!-- 全部产品分类 -->
        <ul id="product">
            <li style="width: 220px; line-height: 50px; text-align: center; background-color: #fff; color: #ccc;  border:1px solid #ccc; font-weight: bold;">全部产品分类</li>
            <li class="sort"><img src="img/sort1.png" class="sortimg"><a href="#" class="sorta">产品类别</a></li>
            <li class="sort"><img src="img/sort2.png" class="sortimg"><a href="#" class="sorta">护肤系列</a></li>
            <li class="sort"><img src="img/sort3.png" class="sortimg"><a href="#" class="sorta">畅销产品</a></li>
            <li class="sort"  style="border-bottom: none;"><img src="img/sort4.png" class="sortimg"><a href="#" class="sorta">特惠专区</a></li>
        </ul>
        <!-- 鼠标移动到分类后出现 -->
        <div id="content">
            <p id="contentp">产品类别</p>
            <img src="img/content1.png" id="contentimg"/>
        </div>
        <!-- banner图 -->
        <img id="banner" height="407px" style="width: 100%;" src="img/banner1.jpg" alt="banner"/>
    </div>
    <!-- ENG -->
    <div id="end-wrap">
        <div id="maintop">
            <p>
                悦诗风吟官网提示
            </p>
            <ul>
                <li>网络诈骗手法猖獗，不法分子通过短信和电话方式，编造虚假信息设置骗局。在此提醒消费者：如收到任何方式（电话、沟通、店铺升级、产品缺货、产品质量问题、补偿等）涉及到退款、转账等操作的均为电信诈骗，如有疑问可及时与店铺客服进行核实。保护个人信息，避免造成财产损失。</li>
                <li>国家药监局提示您：化妆品不能宣称医疗作用，也没有治疗作用，宣称治疗儿童湿疹等皮肤病的产品不属于化妆品。</li>
            </ul>
        </div>
    </div>
    <script>
        // 头部
        var headA = document.getElementById('head-a');
        var Hey = document.getElementById('Hey');
        var sign = document.getElementById('sign');
        var register = document.getElementById('register');
        // 实现滑动鼠标到登陆注册字体放大
        headA.onmouseover = function(){
            Hey.style.fontSize = 40 + 'px';
            Hey.style.display = 'block';
            Hey.style.marginTop = 40 + 'px';
            sign.style.fontSize = 30 + 'px';
            register.style.fontSize = 30 + 'px';
        }
        headA.onmouseleave =function(){
            Hey.style.fontSize = 18 + 'px';
            Hey.style.display = 'inline';
            sign.style.fontSize = 18 + 'px';
            register.style.fontSize = 18 + 'px';
        }
        // 实现鼠标聚焦在搜索栏时默认选项消失,字体变成黑色,并出现热门搜索
        var inp = document.getElementById('inp');
        var PopularSearch = document.getElementById('PopularSearch');
        var headb = document.getElementById('head-b');
        var Popularlist = document.getElementsByClassName('Popularlist');
        inp.onclick = function(){
            inp.value = '';
            inp.style.color = 'black';
            PopularSearch.style.display = 'block';
            for(var i=0;i<Popularlist.length;i++){
                var str = '第四代小绿瓶';
                Popularlist[i].index = i;
                Popularlist[i].onclick = function(){
                    str = Popularlist[this.index].innerText;
                    inp.value = Popularlist[this.index].innerText;
                    PopularSearch.style.display = 'none';   
                }
            }
            var id = setInterval(function(){                
                inp.value = '第四代小绿瓶';
                inp.style.color = '#757575';
                PopularSearch.style.display = 'none';
                clearInterval(id);
            },4000)
        }    
    </script>
    <script>
        // banner图
        var banner = document.getElementById('banner');
        // 实现图片自动切换
        var num=1
        setInterval(function(){
            num++;
            num>4&&(num=1);
            banner.src = 'img/banner' + num +'.jpg';  
        },3000)
        // 实现鼠标滑动到产品分类上时显示各个项目的内容,并变颜色隐含图标
        var sort = document.getElementsByClassName('sort');
        var sortimg = document.getElementsByClassName('sortimg');
        var sorta = document.getElementsByClassName('sorta');
        var content = document.getElementById('content');
        var contentp = document.getElementById('contentp');
        var contentimg = document.getElementById('contentimg');
        var endWrap = document.getElementById('end-wrap');
        for(var i=0;i<sort.length;i++){
            sort[i].index = i;
            sortimg[i].index = i;
            sorta[i].index = i;
            sort[i].onmouseover = function(){
                sort[this.index].style.backgroundColor = '#024137';
                sorta[this.index].style.color = '#fff';
                sortimg[this.index].src = '';
                content.style.display = 'block';
                if(this.index == 1){
                    contentp.innerHTML = "护肤系列";
                }else if(this.index == 2){
                    contentp.innerText = "畅销产品";
                }else if(this.index == 3){
                    contentp.innerText = "特惠专区";
                }
                contentimg.src = 'img/content' + parseInt(this.index+1) + '.png'
                // contentimg.setAttribute('src','img/content' + parseInt(this.index+1) + '.png');
                endWrap.style.marginTop = 29 + 'px';
            }
            sort[i].onmouseout = function(){
                sort[this.index].style.backgroundColor = '#fff';
                sorta[this.index].style.color = 'black';
                sortimg[this.index].src = 'img/sort' + parseInt(this.index+1) + '.png';               
            }
            content.onmouseout = function(){
                content.style.display = 'none';
                endWrap.style.marginTop = 407 + 'px';
            }
        }
    </script>
</body>
</html>